package Server.Poker.DGT;

import java.util.Stack;
import org.json.JSONObject;

import java.util.Vector;

public class Message {

}

class MSG_PACKET {

	int m_wMsgType;
	int m_wMsgLen;
	int m_wSubMsgType;

	public String getJsonData() {
		String sTmp = String.format(",\"m_wMsgType\":%d,\"m_wSubMsgType\":%d", m_wMsgType, m_wSubMsgType);
		return sTmp;
	}

	public void SetMsgType(int wMsgType) {
		m_wMsgType = wMsgType;
	}

}

class MSG_FOR_USER extends MSG_PACKET {
	int GetUserKey() {
		return m_dwUserKey;
	}

	void SetUserKey(int dwKey) {
		m_dwUserKey = dwKey;
	}

	MSG_FOR_USER() {
		m_dwUserKey = 0;
	}

	int m_dwUserKey;

	public String getJsonData() {
		String sTmp = String.format(",\"m_dwUserKey\":%d", m_dwUserKey);
		return super.getJsonData() + sTmp;
	}
};

class MSG_FOR_TABLE extends MSG_PACKET {
	int wSubCmd;
	int wChairID;

	Object byData;
	String strData;

	public String getJsonData() {
		String strHeader = super.getJsonData();
		String sTmp = String.format("%s,\"wSubCmd\":%d,\"wChairID\":%d,\"dataStr\":{%s}", strHeader, wSubCmd, wChairID,
				strData);
		return sTmp;
	}

};
//Ã¨Â¯Â­Ã©Å¸Â³Ã¦â€“Â°
class SUBCMD_S_VoiceMsg extends IJsonExport{
	int m_lUid;
	int m_wUserChairID;
	int m_maxClip;
	int m_currClip;
	float seconds;
	String data;
	
	String getJsonData() {

		String mjmsg = String.format("voicemsg|%d|%d|%f|%s|%d|%d", m_lUid, m_wUserChairID, seconds, data,m_maxClip,m_currClip);
		JSONObject json = new JSONObject();
		json.put("command", "dgtmsg");
		json.put("dgtmsg", mjmsg);

		return json.toString();
	}
};

class tagUserData {
	// �û�����
	int dwFaceID; // ͷ������
	int dwUserID; // �û� I D
	int dwGroupID; // ��������
	int dwGameID; // �û� I D
	int dwUserRight; // �û��ȼ�
	int dwMasterRight; // ����Ȩ��
	String szName; // �û�����
	String szGroupName; // ��������
	String szUnderWrite; // ����ǩ��

	// �û�����
	int cbGender; // �û��Ա�
	int cbMemberOrder; // ��Ա�ȼ�
	int cbMasterOrder; // ����ȼ�
	int cbUserStatus; // �û�״̬

	// �û�״̬
	int wTableID; // ���Ӻ���
	int wChairID; // ����λ��

	// �û�����
	int lScore; // �û�����
	int lGameGold; // ��Ϸ��ң����Ѷ���
	int lStorageGold; // �洢��ң����Ѷ���
	int lWinCount; // ʤ������
	int lLostCount; // ʧ������
	int lDrawCount; // �;�����
	int lFleeCount; // ������Ŀ
	int lExperience; // �û�����
	int lStorageScore; // �洢����

	tagUserData() {

	}

	String getJsonData() {
		String buffer = String.format("{ \"dwUserID\":%d, \"szName\":\"%s\" , \"wChairID\":%d ,\"cbGender\":%d }",
				dwUserID, szName, wChairID, cbGender);
		return buffer;
	}
};

// �û���Ϣ�ṹ
class tagUserProfile {
	String szUserName; // �û��˻�
	String szUserPass; // �û�����
	String szUserRealName; // �û���ʵ����
	String szUserRealIDCard; // �û����֤��
	String szUserRealPhone; // �û��ֻ�

	tagUserProfile() {
	}

	String getJsonData() {
		String buffer = String.format("{\"szUserName\":\"%s\"}", "");
		return buffer;
	}
};

class tagUserEducateData {
	int lEducateScore; // ��������
	int lEducateGiftTime; // �����ͷ�ʱ��

	tagUserEducateData() {
	}

	String getJsonData() {
		String buffer = String.format("{\"lEducateScore\":%d}", lEducateScore);
		return buffer;
	}
};

class Packet_LoginResult extends MSG_FOR_USER {
	enum enumLoginErrorCode {
		enumSuccess, ELoginErrorCode_Wrong_Auth, ELoginErrorCode_Wrong_AlreadyLogin, ELoginErrorCode_ServeUnavailble, ELoginErrorCode_VersionTooLow, ELoginErrorCode_Unknown,
	};

	public Packet_LoginResult() {
		byResult = 0;
		// Constants.memset(UserData,0);
	}

	int byResult;
	tagUserData UserData = new tagUserData();
	tagUserProfile UserProfile = new tagUserProfile();
	tagUserEducateData UserEducateData = new tagUserEducateData();

	public String getJsonData() {
		String sTmp = String.format(",\"byResult\":%d,\"UserData\":%s,\"UserProfile\":%s,\"UserEducateData\":%s",
				byResult, UserData.getJsonData(), UserProfile.getJsonData(), UserEducateData.getJsonData());
		return super.getJsonData() + sTmp;
	}
};

class Packet_UserEnterRoomResult extends MSG_FOR_USER {

	static int enumSuccess = 0;
	static int enumScoreNotEnough = 1;
	static int enumTableIsFull = 2;

	int byResult;
	int dwUserID;
	int lGameGenre;
	String szRoomName;

	public String getJsonData() {
		String sTmp = String.format(",\"byResult\":%d,\"dwUserID\":\"%d\"", byResult, dwUserID);
		return super.getJsonData() + sTmp;
	}
};

// �û���������
class Packet_UserSit extends MSG_FOR_USER {

	static int enumSuccess = 0;
	static int enumScoreNotEnough = 1;
	static int enumTableIsFull = 2;

	int byResult;
	int dwUserID;// �¼ӽ����û�ID
	int wCharID;// ����������
	int wServerType;

	public String getJsonData() {
		String sTmp = String.format(",\"byResult\":%d,\"dwUserID\":%d,\"wCharID\":%d,\"wServerType\":%d", byResult,
				dwUserID, wCharID, wServerType);
		return super.getJsonData() + sTmp;
	}
};

// ��������
enum enScoreKind {
	enScoreKind_Win, // ʤ
	enScoreKind_Lost, // ��
	enScoreKind_Draw, // ��
	enScoreKind_Flee, // ��
	enScoreKind_Service, // ����
	enScoreKind_Present, // ����
};

// ������Ϣ
class tagScoreInfo {
	int lScore; // ��Ϸ����
	int lGameGold; // ��Ϸ���
	int lRevenue; // ��Ϸ����
	enScoreKind ScoreKind; // ��������
};

// ����״̬��Ϣ
class CMD_GR_TableStatus {
	int wTableID; // ���Ӻ���
	int bPlayStatus; // ��Ϸ״̬

	String getJsonData() {
		String sTmp = String.format("  \"wTableID\":%d  ,\"bPlayStatus\":%d ", wTableID, bPlayStatus);
		return sTmp;
	}
};

// ������Ϣ
class CMD_GR_TableInfo {
	// �û�������Ϣ
	int wTableID;
	int bStatus;// ���ӵ�״̬WK_FREEʲô��
	int bReserved;
	tagUserData UserData[] = new tagUserData[5];

	String getJsonData() {

		String sTmp = String.format("\"wTableID\":%d ,\"bStatus\":%d,\"bReserved\":%d  ,\"UserData\":[%s,%s,%s,%s,%s]",
				wTableID, bStatus, bReserved, UserData[0].getJsonData(), UserData[1].getJsonData(),
				UserData[2].getJsonData(),
				UserData[3].getJsonData(),
				UserData[4].getJsonData());
		return sTmp;
	}
};

// �û��з�
class CMD_C_LandScore {
	int bLandScore; // ��������

	String getJsonData() {

		String sTmp = String.format("  \"bLandScore\":%d ", bLandScore);
		return sTmp;
	}
};

// ��Ϸ״̬
class CMD_S_StatusFree {
	int lBaseScore; // ��������
	int tableStart = 0;
	int bScoreTimes[] = new int[5];
	String getJsonData() {
		String sTmp = String.format("\"lBaseScore\":%d", lBaseScore);
		return sTmp;
	}
};

// ��Ϸ״̬
class CMD_S_StatusScore {
	int bLandScore; // ��������
	int lBaseScore; // ��������
	int wFirstUser; // �׽����
	int wBankerUser; // ׯ���û�
	int wCurrentUser; // ��ǰ���
	int bScoreInfo[] = new int[5]; // �з���Ϣ
	int bCardData[][] = new int[5][38]; // �����˿�
	int bBackCard[] = new int[7]; // �����˿�
	boolean bUserTrustee[] = new boolean[Constants.DDZ_PLAYER]; // ����й�

	String getJsonData() {

		String sTmp = String.format(
				"\"bLandScore\":%d  ,\"lBaseScore\":%d,\"wFirstUser\":%d,\"wBankerUser\":%d,\"wCurrentUser\":%d ,\"bScoreInfo\":%s,\"bCardData\": [%s,%s,%s]   ,\"bBackCard\":%s,\"bUserTrustee\":%s ",
				bLandScore, lBaseScore, wFirstUser, wBankerUser, wCurrentUser, Constants.sprintf_Array(bScoreInfo, 5),
				Constants.sprintf_Array(bCardData[0], 38), Constants.sprintf_Array(bCardData[1], 38),
				Constants.sprintf_Array(bCardData[2], 38), Constants.sprintf_Array(bBackCard, 7),
				Constants.sprintf_Array(bUserTrustee, Constants.DDZ_PLAYER));
		return sTmp;
	}

};

// ��Ϸ״̬
class CMD_S_StatusPlay {
	int wLandUser; // �������
	int wBombTime; // ը������
	int lBaseScore; // ��������
	int bLandScore; // ��������
	int wFirstUser; // �׽����
	int wLastOutUser; // ���Ƶ���
	int wCurrentUser; // ��ǰ���
	int wOutBombCount; // ը����Ŀ
	int wGouTui;
	int wdoguser;
	int showdog;
	int ismingpai;
	int selectmingpai[]=new int [5];
	int isjiaogoutui;
	int bBackCard[] = new int[7]; // �����˿�
	int bCardData[][] = new int[5][38]; // �����˿�
	int cbCardData[][] = new int[5][38]; // �����˿�
	int bCardCount[] = new int[5]; // �˿���Ŀ
	int bTurnCardCount; // ��������
	int bTurnCardData[] = new int[38]; // �����б�
	int bScoreTimes[] = new int[5]; // ��������
	boolean bUserTrustee[] = new boolean[Constants.DDZ_PLAYER]; // ����й�

	String getJsonData() {
		String sTmp = String.format(
				"\"wLandUser\":%d  ,\"wBombTime\":%d,\"lBaseScore\":%d,\"bLandScore\":%d,\"wFirstUser\":%d  ,\"wLastOutUser\":%d ,\"wCurrentUser\":%d    ,\"wOutBombCount\":%d,\"bBackCard\":%s,\"bCardData\": [%s,%s,%s,%s,%s] ,\"cbCardData\": [%s,%s,%s,%s,%s]  ,\"bCardCount\":%s,\"bTurnCardCount\":%d    ,\"bTurnCardData\":%s ,\"bScoreTimes\":%s ,\"bUserTrustee\":%s ,\"wGouTui\":%d ,\"wdoguser\":%d,\"ismingpai\":%d,\"selectmingpai\": [%d,%d,%d,%d,%d],\"isjiaogoutui\":%d,\"showdog\":%d " ,
				wLandUser, wBombTime, lBaseScore, bLandScore, wFirstUser, wLastOutUser, wCurrentUser, wOutBombCount,
				Constants.sprintf_Array(bBackCard, 5), Constants.sprintf_Array(bCardData[0], 38),
				Constants.sprintf_Array(bCardData[1], 38), Constants.sprintf_Array(bCardData[2], 38),
				Constants.sprintf_Array(bCardData[3], 38),Constants.sprintf_Array(bCardData[4], 38),Constants.sprintf_Array(cbCardData[0], 38),
				Constants.sprintf_Array(cbCardData[1], 38), Constants.sprintf_Array(cbCardData[2], 38),
				Constants.sprintf_Array(cbCardData[3], 38),Constants.sprintf_Array(cbCardData[4], 38),
				Constants.sprintf_Array(bCardCount, 5), bTurnCardCount, Constants.sprintf_Array(bTurnCardData, 38),
				Constants.sprintf_Array(bScoreTimes, 5), Constants.sprintf_Array(bUserTrustee, Constants.DDZ_PLAYER),wGouTui,wdoguser,ismingpai,selectmingpai[0],selectmingpai[1],selectmingpai[2],selectmingpai[3],selectmingpai[4],isjiaogoutui,showdog);
		return sTmp;
	}
};

// �û��뿪����
class CMD_S_UserLeaveTable {
	int dwUserID;// �¼ӽ����û�ID
	int wCharID;// ����������

	String getJsonData() {

		String sTmp = String.format("\"dwUserID\":%d ,\"wCharID\":%d ", dwUserID, wCharID);
		return sTmp;
	}
};
class CMD_S_JiaoGouTui {
	int jiaogoutui;// �¼ӽ����û�ID
	int wCharID;// ����������

	String getJsonData() {

		String sTmp = String.format("\"jiaogoutui\":%d ,\"wCharID\":%d ", jiaogoutui, wCharID);
		return sTmp;
	}
};
// �û�״̬
class CMD_GR_UserStatus {
	int dwUserID; // ���ݿ� ID
	int wTableID; // ����λ��
	int wChairID; // ����λ��
	int cbUserStatus; // �û�״̬

	String getJsonData() {
		String sTmp = String.format("  \"dwUserID\":%d    ,\"wTableID\":%d   ,\"wChairID\":%d,\"cbUserStatus\":%d ",
				dwUserID, wTableID, wChairID, cbUserStatus);
		return sTmp;
	}
};

// ������Ϣ
class CMD_GR_UserInfo {
	// �û�������Ϣ
	tagUserData UserData;

	String getJsonData() {

		String sTmp = String.format("\"UserData\":%s", UserData.getJsonData());
		return sTmp;
	}
};

// �û�����
class CMD_GR_UserScore {
	int dwUserID; // �û� I D

	int lScore; // �û�����
	int lGameGold; // ��Ϸ���//
	int lStorageGold; // �洢���
	int lWinCount; // ʤ������
	int lLostCount; // ʧ������
	int lDrawCount; // �;�����
	int lFleeCount; // ������Ŀ
	int lExperience; // �û�����

	String getJsonData() {

		String sTmp = String.format(
				"  \"dwUserID\":%d    ,\"lScore\":%d   ,\"lGameGold\":%d,\"lStorageGold\":%d ,\"lWinCount\":%d     ,\"lLostCount\":%d   ,\"lDrawCount\":%d  ,\"lFleeCount\":%d ,\"lExperience\":%d       ",
				dwUserID, lScore, lGameGold, lStorageGold, lWinCount, lLostCount, lDrawCount, lFleeCount, lExperience);
		return sTmp;
	}
};

// ��������
class CMD_S_PassCard {
	int bNewTurn; // һ�ֿ�ʼ
	int wPassUser; // �������
	int wCurrentUser; // ��ǰ���
	int first;
	int bCardData[] = new int[38]; // �˿��б�
	int changpaiuser;
	int showdog;
	int dogchair;
	int buchangpai;

	String getJsonData() {

		String sTmp = String.format("  \"bNewTurn\":%d  ,\"wPassUser\":%d , \"wCurrentUser\":%d , \"first\":%d, \"changpaiuser\":%d, \"showdog\":%d, \"dogchair\":%d , \"buchangpai\":%d,\"bCardData\": [", bNewTurn, wPassUser,
				wCurrentUser,first,changpaiuser,showdog,dogchair,buchangpai);
		String str = sTmp;
		for (int i = 0; i < 38 ; i++) {
			sTmp = String.format(i == 0 ? "%d" : ",%d", bCardData[i]);
			str += sTmp;
		}
		str += "]";
		return str;
	}
};

// �û�����
class CMD_S_OutCard {
	int bCardCount; // ������Ŀ
	int wCurrentUser; // ��ǰ���
	int wOutCardUser; // �������
	int bCardData[] = new int[38]; // �˿��б�
	int bHandCardData[] = new int[38]; // �˿��б�
	int handcardcount;
	int isMingPai;
	int bGouTuiCard;
	int showdog;
	String getJsonData() {
		
		String sTmp = String.format(
				" \"bHandCardData\":%s , \"handcardcount\":%d , \"isMingPai\":%d, \"showdog\":%d, \"bGouTuiCard\":%d, \"bCardCount\":%d  ,\"wCurrentUser\":%d , \"wOutCardUser\":%d  ,\"bCardData\":  [ ",Constants.sprintf_Array(bHandCardData, 38), handcardcount,isMingPai,showdog,bGouTuiCard,bCardCount,
				wCurrentUser, wOutCardUser);
		String str = sTmp;
		for (int i = 0; i < 38 && i < bCardCount; i++) {
			sTmp = String.format(i == 0 ? "%d" : ",%d", bCardData[i]);
			str += sTmp;
		}
		
		str += "]";
	
		return str;
	}
};

// �������ݰ�
class CMD_C_OutCard {
	int bCardCount; // ������Ŀ
	int bCardData[] = new int[38]; // �˿��б�
	int isGouTui;

	String getJsonData() {

		String sTmp = String.format("  \"bCardCount\":%d ,\"bCardData\":%s ,\"isGouTui\":%d", bCardCount,
				Constants.sprintf_Array(bCardData, 38),isGouTui);
		return sTmp;
	}

	void setCardData(String dataStr) {
		String [] vs = dataStr.split(",");
		if (vs.length == bCardCount)
		{
			for (int i = 0; i < vs.length && i < 38; i++)
			{
				bCardData[i] = Constants.atoi(vs[i]);
			}
		}
	}
};

//�������ݰ�
class CMD_CURRENT_OutCard {
	int bCardCount; // ������Ŀ
	int bCardData[] = new int[38]; // �˿��б�

	void setCardData(int[] cardData,int cardCount) {
		for (int i = 0; i < cardCount && i < 38; i++)
		{
			bCardData[i] = cardData[i];
		}
	}
};

// 脙茠脗炉脙鈥毭偮棵冣�毭偮矫兤捗偮冣�毭偮棵冣�毭偮矫兤捗柯矫冣�毭偮访兤捗偮冣�毭偮棵冣�毭偮矫兤捗偮冣�毭偮棵冣�毭偮矫兤捗偮冣�毭偮棵冣�毭偮矫兤捗偮冣�毭偮棵冣�毭偮�
class CMD_S_GameEnd {
	int lGameTax; // 脙茠脗炉脙鈥毭偮棵冣�毭偮矫兤捗偮冣�毭偮棵冣�毭偮矫兤捗柯矫冣�毭偮访兤捗⑩偓鹿脙鈥毭偮懊兤捗偮冣�毭偮棵冣�毭偮矫兤捗偮冣�毭偮棵冣�毭偮�
	int dwUserID[] = new int[5]; // 脙茠脗炉脙鈥毭偮棵冣�毭偮矫兤捗偮冣�毭偮棵冣�毭偮矫兤捗偮冣�毭偮棵冣�毭偮絀D
	int lGameScore[] = new int[5]; // 脙茠脗炉脙鈥毭偮棵冣�毭偮矫兤捗偮冣�毭偮棵冣�毭偮矫兤捗柯矫冣�毭偮访兤捗偮冣�毭偮棵冣�毭偮矫兤捗偮冣�毭偮棵冣�毭偮矫兤捗偮冣�毭偮棵冣�毭偮矫兤捗偮冣�毭偮棵冣�毭偮�
	int bCardCount[] = new int[5]; // 脙茠脗炉脙鈥毭偮棵冣�毭偮矫兤捗⑩偓鹿脙鈥毭偮棵兤捗偮冣�毭偮棵冣�毭偮矫兤捗偮冣�毭偮棵冣�毭偮矫兤捗偮冣�毭偮棵冣�毭偮矫兤捗⑩偓啪脙鈥毭偮�
	int bCardData[] = new int[162]; // 脙茠脗炉脙鈥毭偮棵冣�毭偮矫兤捗⑩偓鹿脙鈥毭偮棵兤捗偮冣�毭偮棵冣�毭偮矫兤捗偮冣�毭偮棵冣�毭偮矫兤捗柯矫冣�毭偮泵兤捗偮冣�毭偮棵冣�毭偮�
	int bBackCard[] = new int[5]; // 脙茠脗炉脙鈥毭偮棵冣�毭偮矫兤捗偮冣�毭偮棵冣�毭偮矫兤捗偮冣�毭偮棵冣�毭偮矫兤捗偮冣�毭偮棵冣�毭偮矫兤捗偮冣�毭偮棵冣�毭偮矫兤捗⑩偓鹿脙鈥毭偮棵兤捗偮冣�毭偮棵冣�毭偮�
	int m_bombArray[] = new int[5];//脙茠芒鈧⒚冣�毭偮兤捗偮冣�毭偮棵冣�毭偮矫兤捗偮冣�毭偮棵冣�毭偮矫兤捗偮冣�毭偮棵冣�毭偮矫兤捗偮冣�毭偮棵冣�毭偮矫兤捗偮冣�毭偮棵冣�毭偮矫兤捗偮冣�毭偮棵冣�毭偮�
	int m_goutui;
	int m_dizhu;
	int m_guanmen = 0;
	int liuju;
	int jushuing;
	
	String getJsonData() {
		
		String sTmp = String.format(
				"  \"lGameTax\":%d ,\"dwUserID\":%s  ,\"lGameScore\":%s ,\"bCardCount\":%s ,\"bCardData\":%s ,\"bBackCard\":%s,\"m_bombArray\":%s,\"m_guanmen\":%s,\"m_goutui\":%d,\"m_dizhu\":%d,\"liuju\":%d,\"jushuing\":%d",
				lGameTax, Constants.sprintf_Array(dwUserID, 5), Constants.sprintf_Array(lGameScore, 5),
				Constants.sprintf_Array(bCardCount, 5), Constants.sprintf_Array(bCardData, 162),
				Constants.sprintf_Array(bBackCard, 5),Constants.sprintf_Array(m_bombArray, 5),m_guanmen,m_goutui,m_dizhu,liuju,jushuing);
		return sTmp;
	}

};

//class tagUserReport {
//	int lUid;
//	int zhaDan;
//	String zhanji;
//	int cntDianPao;
//	int cntGang;	
//	int lWinScore;
//	int lLoseScore;
//	int lResultScore;
//
//	public String toString() {
//		String data = String.format("%d#%d#%d#%d#%d#%d#%d#%d", lUid, cntZiMo, cntHu, cntDianPao,cntGang, lWinScore, lLoseScore,
//				lResultScore);
//
//		return data;
//	}
//};

// �����˿�
class CMD_S_SendAllCard {
	int wCurrentUser; // ÃƒÂ¯Ã‚Â¿Ã‚Â½ÃƒÂ¯Ã‚Â¿Ã‚Â½Ãƒâ€¡Ã‚Â°ÃƒÂ¯Ã‚Â¿Ã‚Â½ÃƒÂ¯Ã‚Â¿Ã‚Â½ÃƒÂ¯Ã‚Â¿Ã‚Â½
	int chongkaiju;
	int bCardData[][] = new int[Constants.DDZ_PLAYER][38]; // ÃƒÂ¯Ã‚Â¿Ã‚Â½Ãƒâ€¹Ã‚Â¿ÃƒÂ¯Ã‚Â¿Ã‚Â½ÃƒÂ¯Ã‚Â¿Ã‚Â½Ãƒï¿½Ã‚Â±ÃƒÂ¯Ã‚Â¿Ã‚Â½
	int bBackCardData[] = new int[7]; // ÃƒÂ¯Ã‚Â¿Ã‚Â½ÃƒÂ¯Ã‚Â¿Ã‚Â½ÃƒÂ¯Ã‚Â¿Ã‚Â½ÃƒÂ¯Ã‚Â¿Ã‚Â½ÃƒÂ¯Ã‚Â¿Ã‚Â½Ãƒâ€¹Ã‚Â¿ÃƒÂ¯Ã‚Â¿Ã‚Â½
	int bExtCard;

	String getJsonData() {
		String strbCardData = Constants.sprintf_Array(bCardData[0], 38);
		String strbCardData1 = Constants.sprintf_Array(bCardData[1], 38);
		String strbCardData2 = Constants.sprintf_Array(bCardData[2], 38);
		String strbCardData3 = Constants.sprintf_Array(bCardData[3], 38);
		String strbCardData4 = Constants.sprintf_Array(bCardData[4], 38);
		String strbackCardData = Constants.sprintf_Array(bBackCardData, 7);

		String sTmp = String.format(
				"  \"wCurrentUser\":%d,\"chongkaiju\":%d  ,\"bExtCard\":%d ,\"bCardData\":[%s,%s,%s,%s,%s] ,\"bBackCardData\":%s", wCurrentUser,chongkaiju,
				bExtCard, strbCardData, strbCardData1, strbCardData2,strbCardData3,strbCardData4, strbackCardData);

		return sTmp;
	}
};

// �йܽṹ
class CMD_C_UserTrustee {
	int wUserChairID; // �������
	boolean bTrustee; // �йܱ�ʶ

	String getJsonData() {
		String sTmp = String.format("  \"wUserChairID\":%d  ,\"bTrustee\":%d  ", wUserChairID, bTrustee?1:0);
		return sTmp;
	}
};

// ��Ϸ��ʼ
class CMD_S_GameStart {
	int wLandUser; // ÃƒÂ¯Ã‚Â¿Ã‚Â½ÃƒÂ¯Ã‚Â¿Ã‚Â½ÃƒÂ¯Ã‚Â¿Ã‚Â½ÃƒÂ¯Ã‚Â¿Ã‚Â½ÃƒÂ¯Ã‚Â¿Ã‚Â½ÃƒÂ¯Ã‚Â¿Ã‚Â½ÃƒÂ¯Ã‚Â¿Ã‚Â½
	int bLandScore; // ÃƒÂ¯Ã‚Â¿Ã‚Â½ÃƒÂ¯Ã‚Â¿Ã‚Â½ÃƒÂ¯Ã‚Â¿Ã‚Â½ÃƒÂ¯Ã‚Â¿Ã‚Â½ÃƒÂ¯Ã‚Â¿Ã‚Â½ÃƒÂ¯Ã‚Â¿Ã‚Â½ÃƒÂ¯Ã‚Â¿Ã‚Â½ÃƒÂ¯Ã‚Â¿Ã‚Â½
	int wCurrentUser; // ÃƒÂ¯Ã‚Â¿Ã‚Â½ÃƒÂ¯Ã‚Â¿Ã‚Â½Ãƒâ€¡Ã‚Â°ÃƒÂ¯Ã‚Â¿Ã‚Â½ÃƒÂ¯Ã‚Â¿Ã‚Â½ÃƒÂ¯Ã‚Â¿Ã‚Â½
	int bBackCard[] = new int[7]; // ÃƒÂ¯Ã‚Â¿Ã‚Â½ÃƒÂ¯Ã‚Â¿Ã‚Â½ÃƒÂ¯Ã‚Â¿Ã‚Â½ÃƒÂ¯Ã‚Â¿Ã‚Â½ÃƒÂ¯Ã‚Â¿Ã‚Â½Ãƒâ€¹Ã‚Â¿ÃƒÂ¯Ã‚Â¿Ã‚Â½
	int bGouTui;
	int doguser;
	int chongkaiju;

	String getJsonData() {

		String sTmp = String.format(
				"  \"wLandUser\":%d  ,\"bLandScore\":%d , \"wCurrentUser\":%d  ,\"bBackCard\":[%d,%d,%d,%d,%d,%d,%d] ,\"bGouTui\":%d ,\"doguser\":%d,\"chongkaiju\":%d ", wLandUser,
				bLandScore, wCurrentUser, bBackCard[0], bBackCard[1], bBackCard[2],bBackCard[3],bBackCard[4],bBackCard[5],bBackCard[6],bGouTui,doguser,chongkaiju);
		return sTmp;
	}
};
class CMD_S_PlayerGouTui {
	int chairID;
	int onevsfour;
	String getJsonData() {

		String sTmp = String.format("  \"chairID\":%d ,\"onevsfour\":%d", chairID,onevsfour
			);
		return sTmp;
	}
};

// �û��з�
class CMD_S_LandScore {
	int wLandUser; // �з����
	int wCurrentUser; // ��ǰ���
	int bLandScore; // �ϴνз�
	int bCurrentScore; // ��ǰ�з�

	String getJsonData() {
		String sTmp = String.format(
				"  \"wLandUser\":%d  ,\"wCurrentUser\":%d , \"bLandScore\":%d  ,\"bCurrentScore\":%d ", wLandUser,
				wCurrentUser, bLandScore, bCurrentScore);
		return sTmp;
	}
};

// �û���������
class CMD_S_UserEnterTable {
	int dwUserID;// �¼ӽ����û�ID
	String szName; // �û�����
	int wTableID;// ����������
	int wCharID;// ����������
	int lTableType;
	int lBaseScore;// CellScore

	String getJsonData() {

		String sTmp = String.format(
				"\"dwUserID\":%d ,\"szName\":\"%s\"  ,\"wTableID\":%d  ,\"wCharID\":%d  ,\"lTableType\":%d  ,\"lBaseScore\":%d   ",
				dwUserID, szName, wTableID, wCharID, lTableType, lBaseScore);
		return sTmp;
	}
};

class tagOutCardResult_Server {
	int cbCardCount; // �˿���Ŀ
	int cbResultCard[] = new int[Constants.MAX_COUNT]; // ����˿�
};

// ջ�ṹ
class tagStackHandCardInfo {

	// ��������

	// ���캯��
	public tagStackHandCardInfo() {
		m_HandCardInfoFreeArray.clear();
		m_HandCardInfoArray.clear();
	}

	// Ԫ��ѹջ
	void Push(tagHandCardInfo_Server pHandCardInfo) {
		tagHandCardInfo_Server pNewHandCardInfo = null;

		int nECount = m_HandCardInfoFreeArray.size();
		if (nECount > 0) {
			// ��ȡԪ��
			pNewHandCardInfo = m_HandCardInfoFreeArray.get(nECount - 1);
			// �Ƴ�Ԫ��
			m_HandCardInfoFreeArray.pop();
		} else {
			// ����ռ�
			pNewHandCardInfo = new tagHandCardInfo_Server();
		}

		// Ԫ�ظ�ֵ
		Constants.CopyMemory(pNewHandCardInfo.cbHandCardData, pHandCardInfo.cbHandCardData);
		pNewHandCardInfo.cbHandCardCount = pHandCardInfo.cbHandCardCount;
		pNewHandCardInfo.CardTypeResult = pHandCardInfo.CardTypeResult.clone();
		// ѹ��ջ��
		m_HandCardInfoArray.push(pNewHandCardInfo);
	}

	// ����ջ��
	void Pop() {

		// �ǿ��ж�
		if (IsEmpty())
			return;

		// ��ȡԪ��
		int nECount = m_HandCardInfoArray.size();
		tagHandCardInfo_Server pTopHandCardInfo = m_HandCardInfoArray.get(nECount - 1);

		// �Ƴ�Ԫ��
		m_HandCardInfoArray.pop();

		// ����ռ�
		m_HandCardInfoFreeArray.push(pTopHandCardInfo);
	}

	// ��ʼջ
	void InitStack() {
		// ����ռ�
		while (0 < m_HandCardInfoArray.size()) {
			tagHandCardInfo_Server pHandCardInfo = (m_HandCardInfoArray.firstElement());
			m_HandCardInfoArray.remove(m_HandCardInfoArray.firstElement());
			m_HandCardInfoFreeArray.push(pHandCardInfo);
		}
	}

	// ���ջ
	void ClearAll() {
		m_HandCardInfoArray.clear();
		m_HandCardInfoFreeArray.clear();
	}

	// ��ȡջ��
	tagHandCardInfo_Server GetTop(tagHandCardInfo_Server pHandCardInfo) {

		// �ǿ��ж�
		if (IsEmpty()) {
			return null;
		}

		// ��ȡԪ��
		int nECount = m_HandCardInfoArray.size();
		pHandCardInfo = m_HandCardInfoArray.get(nECount - 1);
		return pHandCardInfo;
	}

	// ���ж�
	boolean IsEmpty() {
		return m_HandCardInfoArray.isEmpty();
	}

	// ��Ա����
	Stack<tagHandCardInfo_Server> m_HandCardInfoFreeArray = new Stack<>(); // �˿���Ϣ
	Stack<tagHandCardInfo_Server> m_HandCardInfoArray = new Stack<>(); // �˿���Ϣ

};

class tagOutCardTypeResult_Server {
	int cbCardType; // �˿�����
	int cbCardTypeCount; // ������Ŀ
	int cbEachHandCardCount[] = new int[Constants.MAX_TYPE_COUNT];// ÿ�ָ���
	int cbCardData[][] = new int[Constants.MAX_TYPE_COUNT][Constants.MAX_COUNT];// �˿�����

	public static void init(tagOutCardTypeResult_Server[] arrays) {
		for (int i = 0; i < arrays.length; i++) {
			arrays[i] = new tagOutCardTypeResult_Server();
		}
	}
};

// �˿���Ϣ
class tagHandCardInfo_Server {
	int cbHandCardData[] = new int[Constants.MAX_COUNT]; // �˿�����
	int cbHandCardCount; // �˿���Ŀ
	tagOutCardTypeResult_Server CardTypeResult[] = new tagOutCardTypeResult_Server[12 + 1]; // ��������
	{
		for (int i = 0; i < CardTypeResult.length; i++) {
			CardTypeResult[i] = new tagOutCardTypeResult_Server();
		}
	}

	// ��ʼ����
	tagHandCardInfo_Server() {
		Constants.ZeroMemory(cbHandCardData);
		cbHandCardCount = 0;
	}
};

// �����ṹ
class tagAnalyseResult_Server {
	int cbTwelveCount;              //ʮ����
	int cbElevenCount;              //ʮһ��
	int cbTenCount;                //ʮ����Ŀ
	int cbNineCount;               //������Ŀ
	int cbEightCount;             //������Ŀ
	int cbSevenCount;             //������Ŀ
	int cbSixCount;               //������Ŀ
	int cbFiveCount;              //������Ŀ	
	int cbFourCount; // ������Ŀ
	int cbThreeCount; // ������Ŀ
	int cbDoubleCount; // ������Ŀ
	int cbSignedCount; // ������Ŀ
	int cbTwelveCardData[] = new int[Constants.MAX_COUNT];
	int cbElevenCardData[] = new int[Constants.MAX_COUNT];
	int cbTenCardData[] = new int[Constants.MAX_COUNT];
	int cbNineCardData[] = new int[Constants.MAX_COUNT];
	int cbEightCardData[] = new int[Constants.MAX_COUNT];
	int cbSevenCardData[] = new int[Constants.MAX_COUNT];
	int cbSixCardData[] = new int[Constants.MAX_COUNT];
	int cbFiveCardData[] = new int[Constants.MAX_COUNT];
	int cbFourCardData[] = new int[Constants.MAX_COUNT]; // �����˿�
	int cbThreeCardData[] = new int[Constants.MAX_COUNT]; // �����˿�
	int cbDoubleCardData[] = new int[Constants.MAX_COUNT]; // �����˿�
	int cbSignedCardData[] = new int[Constants.MAX_COUNT]; // �����˿�
};

// �û�����
class tagUserRule {
	boolean bPassword; // ��������
	boolean bLimitWin; // ����ʤ��
	boolean bLimitFlee; // ��������
	boolean bLimitScore; // ���Ʒ���
	boolean bCheckSameIP; // Ч���ַ
	int wWinRate; // ʤ������
	int wFleeRate; // ��������
	int lMaxScore; // ��߷���
	int lLessScore; // ��ͷ���
	String szPassword; // ��������
};

// �û�������Ϣ
class tagUserScore {
	int lScore; // �û�����
	int lGameGold; // ��Ϸ���//
	int lStorageGold; // �洢���
	int lWinCount; // ʤ������
	int lLostCount; // ʧ������
	int lDrawCount; // �;�����
	int lFleeCount; // ������Ŀ
	int lExperience; // �û�����
};



class IJsonExport {
	public String toString() {
		return getJsonData();
	}

	private String getJsonData() {
		return "";
	}

	public static String sprintf_BYTE(int by[][], int count) {

		int tmpCardData[] = new int[count]; // �û��˿�
		for (int i = 0; i < by.length; i++) {
			for (int k = 0; k < by[i].length; k++) {
				tmpCardData[i * by[i].length + k] = by[i][k];
			}
		}
		String strCardData = sprintf_BYTE(tmpCardData, count);
		return strCardData;
	}

	public static String sprintf_BYTE(Integer by[][], int count) {

		int tmpCardData[] = new int[count]; // �û��˿�
		for (int i = 0; i < by.length; i++) {
			for (int k = 0; k < by[i].length; k++) {
				tmpCardData[i * by[i].length + k] = by[i][k];
			}
		}
		String strCardData = sprintf_BYTE(tmpCardData, count);
		return strCardData;
	}

	public static String sprintf_BYTE(Integer by[], int count) {
		return sprintf_INT32(by, count);
	}

	public static String sprintf_BYTE(int by[], int count) {
		return sprintf_INT32(by, count);
	}

	public static String sprintf_DWORD(int dw[], int count) {
		return sprintf_INT32(dw, count);
	}

	public static String sprintf_INT32(Integer dw[], int count) {
		if (count < 1) {
			return "";
		}
		StringBuffer out_str = new StringBuffer();
		out_str.append(dw[0]);
		for (int i = 1; i < count; i++) {
			out_str.append(",");
			out_str.append(dw[i]);
		}
		return out_str.toString();
	}

	public static String sprintf_INT32(int dw[], int count) {
		if (count < 1) {
			return "";
		}
		StringBuffer out_str = new StringBuffer();
		out_str.append(dw[0]);
		for (int i = 1; i < count; i++) {
			out_str.append(",");
			out_str.append(dw[i]);
		}
		return out_str.toString();
	}
}

class SUBCMD_S_Param extends IJsonExport {

	int m_dwTableID;// ����ID
	String szParam;
	String szRoomDesc;
	
	String getJsonData() {

		String mjmsg = String.format("param|%d|%s|%s", m_dwTableID, szParam,szRoomDesc);

		JSONObject json = new JSONObject();
		json.put("command", "dgtmsg");
		json.put("dgtmsg", mjmsg);

		return json.toString();
	}
};

class SSeatInfo {
	int m_lUid;// UID
	int m_iTotalCoin;// COIN
	String m_NickName;// NICKNAME
	int m_iBetCoin;//
	int m_cbGender;//
	int m_iAvatar;//
	int m_iSeatId;
	int m_cbUserStatus;// �û�״̬
	int m_iVipLevel;// VIP LEVEL
	int m_iTitle;// �ƺ�
	int m_isLookon;// �Ƿ����
	String szIP;

	public String toString() {

		String dgtmsg = String.format("%d#%d#%s#%d#%d#%d#%d#%d#%d#%d#%s", m_lUid, m_iTotalCoin, m_NickName, m_iBetCoin,
				m_cbGender, m_iAvatar, m_cbUserStatus, m_iVipLevel, m_iTitle, m_isLookon, szIP);
		return dgtmsg;
	}
};


class SUBCMD_S_Sit extends IJsonExport{		
	int	 m_lUid;      	
	int	 m_wUserChairID;//��λID 
	int	 m_dwTableID;//����ID
	int	 m_lUserScore;
	String	szNickName;
	int	m_cbGender;
	int		m_iAvatar;
	String	szIP;

	String getJsonData() {

		String dgtmsg = String.format("sit|%d|%d|%d|%d|%s|%d|%d|%s", m_lUid, m_wUserChairID, m_dwTableID,
				m_lUserScore, szNickName, m_cbGender, m_iAvatar, szIP);
		JSONObject json = new JSONObject();
		json.put("command", "dgtmsg");
		json.put("dgtmsg", dgtmsg);

		return json.toString();
	}
};

//ͷ��
class SUBCMD_S_Avatar extends IJsonExport {
	int m_lUid;// �ĸ����ID���
	String szAvatarURL;

	String getJsonData() {

		String dgtmsg = String.format("avatar|%d|%s", m_lUid, szAvatarURL);
		JSONObject json = new JSONObject();
		json.put("command", "dgtmsg");
		json.put("dgtmsg", dgtmsg);

		return json.toString();
	}
};
//�������
class SUBCMD_S_BiaoQing extends IJsonExport {
	int m_lUid;// �ĸ����ID���
	int m_wUserChairID;// �����λ
	int m_iBiaoQingIndex;

	String getJsonData() {

		String dgtmsg = String.format("biaoqing|%d|%d|%d", m_lUid, m_wUserChairID, m_iBiaoQingIndex);
		JSONObject json = new JSONObject();
		json.put("command", "dgtmsg");
		json.put("dgtmsg", dgtmsg);

		return json.toString();
	}
};

//����
class SUBCMD_S_YuYin extends IJsonExport {
	int m_lUid;// �ĸ����ID���
	int m_wUserChairID;// �����λ��
	int m_iYuYinIndex;

	String getJsonData() {

		String dgtmsg = String.format("yuyin|%d|%d|%d", m_lUid, m_wUserChairID, m_iYuYinIndex);
		JSONObject json = new JSONObject();
		json.put("command", "dgtmsg");
		json.put("dgtmsg", dgtmsg);

		return json.toString();
	}
};

//��������
class SUBCMD_S_Chat extends IJsonExport {
	int m_lUid;// �ĸ����ID���
	int m_wUserChairID;// �����λ��
	String szContent;

	String getJsonData() {

		String dgtmsg = String.format("chat|%d|%d|%s", m_lUid, m_wUserChairID, szContent);
		JSONObject json = new JSONObject();
		json.put("command", "dgtmsg");
		json.put("dgtmsg", dgtmsg);

		return json.toString();
	}
};

//����
class SUBCMD_S_Voice extends IJsonExport {
	int m_lUid;// �ĸ����ID���
	int m_wUserChairID;// �����λ��
	int seconds;
	String szVoiceURL;

	String getJsonData() {

		String dgtmsg = String.format("voice|%d|%d|%d|%s", m_lUid, m_wUserChairID, seconds, szVoiceURL);
		JSONObject json = new JSONObject();
		json.put("command", "dgtmsg");
		json.put("dgtmsg", dgtmsg);

		return json.toString();
	}
};
class SUBCMD_S_TryDismissRoom extends IJsonExport {
	int lUid;
	String szNickName;//
	int dwTableID;// ����ID

	String getJsonData() {
		String dgtmsg = String.format("try_dismissroom|%d|%s|%d", lUid, szNickName, dwTableID);

		JSONObject json = new JSONObject();
		json.put("command", "dgtmsg");
		json.put("dgtmsg", dgtmsg);

		return json.toString();
	}
};

class SUBCMD_S_DismissRoom extends IJsonExport {
	int cbResult;
	int lUid;
	int m_wUserChairID;// ��λID
	int m_dwTableID;// ����ID

	String getJsonData() {

		String dgtmsg = String.format("dismissroom|%d|%d|%d|%d", cbResult, lUid, m_wUserChairID, m_dwTableID);
		JSONObject json = new JSONObject();
		json.put("command", "dgtmsg");
		json.put("dgtmsg", dgtmsg);

		return json.toString();
	}
};
class SUBCMD_S_InBack extends IJsonExport{
	int byActionUser;
	String getJsonData(){
		String dgtmsg = String.format("inBack|%d", byActionUser);
		JSONObject json = new JSONObject();
		json.put("command", "dgtmsg");
		json.put("dgtmsg", dgtmsg);
		return json.toString();
	}
}
class SUBCMD_S_InFore extends IJsonExport{
	int byActionUser;
	String getJsonData(){
		String dgtmsg = String.format("inFore|%d", byActionUser);
		JSONObject json = new JSONObject();
		json.put("command", "dgtmsg");
		json.put("dgtmsg", dgtmsg);
		return json.toString();
	}
}
class SUBCMD_S_Table extends IJsonExport{ //Ãƒï¿½Ã‚Â¬ÃƒÂ¯Ã‚Â¿Ã‚Â½ÃƒÂ¯Ã‚Â¿Ã‚Â½ÃƒÂ¯Ã‚Â¿Ã‚Â½ÃƒÂ¯Ã‚Â¿Ã‚Â½ÃƒÂ¯Ã‚Â¿Ã‚Â½ÃƒÂ¯Ã‚Â¿Ã‚Â½ÃƒÂ¯Ã‚Â¿Ã‚Â½ÃƒÂ¯Ã‚Â¿Ã‚Â½ÃƒÂ¯Ã‚Â¿Ã‚Â½ÃƒÂ¯Ã‚Â¿Ã‚Â½ÃƒÂ¯Ã‚Â¿Ã‚Â½Ãƒï¿½Ã‚Â¢
	int	 m_dwTableID;//ÃƒÂ¯Ã‚Â¿Ã‚Â½ÃƒÂ¯Ã‚Â¿Ã‚Â½ÃƒÂ¯Ã‚Â¿Ã‚Â½ÃƒÂ¯Ã‚Â¿Ã‚Â½ID			
	int	m_bTableStarted;//Ãƒâ€“Ã‚Â»Ãƒâ€™Ã‚ÂªÃƒÂ¯Ã‚Â¿Ã‚Â½ÃƒÂ¯Ã‚Â¿Ã‚Â½ÃƒÅ Ã‚Â¼ÃƒÂ¯Ã‚Â¿Ã‚Â½ÃƒÂ¯Ã‚Â¿Ã‚Â½
	int	m_byRound;//
	int	m_byMaxRound;//		
	int	m_bGameStarted;//ÃƒÂ¯Ã‚Â¿Ã‚Â½ÃƒÂ¯Ã‚Â¿Ã‚Â½Ãƒï¿½Ã‚Â·ÃƒÂ¯Ã‚Â¿Ã‚Â½ÃƒÂ¯Ã‚Â¿Ã‚Â½ÃƒÅ Ã‚Â¼	
	int	m_cntUser;//ÃƒÂ¯Ã‚Â¿Ã‚Â½ÃƒÂ¯Ã‚Â¿Ã‚Â½ÃƒÂ¯Ã‚Â¿Ã‚Â½ÃƒÂ¯Ã‚Â¿Ã‚Â½ÃƒÂ¯Ã‚Â¿Ã‚Â½ÃƒÂ¯Ã‚Â¿Ã‚Â½ÃƒÂ¯Ã‚Â¿Ã‚Â½
	int	m_cntLookon;//ÃƒÂ¯Ã‚Â¿Ã‚Â½ÃƒÂ¯Ã‚Â¿Ã‚Â½ÃƒÂ¯Ã‚Â¿Ã‚Â½ÃƒÂ¯Ã‚Â¿Ã‚Â½ÃƒÂ¯Ã‚Â¿Ã‚Â½ÃƒÂ¯Ã‚Â¿Ã‚Â½ÃƒÂ¯Ã‚Â¿Ã‚Â½ÃƒÂ¯Ã‚Â¿Ã‚Â½
	int m_score;
	int m_wanfa;
	int onevsfour;
	String m_payWay;
	String vecInputWenZi;
	public SUBCMD_S_Table(){
		for (int i = 0; i < 5; i++) {
			 m_seatInfo[i] = new SSeatInfo();
		}
	}
	SSeatInfo	m_seatInfo[] = new SSeatInfo[5];
	public String getJsonData(){
		String dgtmsg = String.format("table|%d|%d|%d|%d|%d|%d|%d|%s|%s|%s|%s|%s|%s|%d|%d|%d|%S", m_dwTableID, m_bTableStarted, m_byRound, m_byMaxRound,m_bGameStarted, m_cntUser, m_cntLookon,
			m_seatInfo[0].toString(), m_seatInfo[1].toString(), m_seatInfo[2].toString(),m_seatInfo[3].toString(),m_seatInfo[4].toString(),m_payWay,m_score,m_wanfa,onevsfour,vecInputWenZi);
		JSONObject json = new JSONObject();
		json.put("command", "dgtmsg");
		json.put("dgtmsg", dgtmsg);	
		
		return json.toString();		
	}
};


class SUBCMD_S_TableBegin extends IJsonExport {
	String strParam;
	int byZhuang;
	long byRound;//
	long byMaxRound;
	int byYuPai[] = new int[5];//
	int byCurrentUser;
	int lScore[] = new int[5];
	int lRoundScore[] = new int[5];
	int byLastOutCard[] = new int[2];

	String getJsonData() {
		String stryuPai = sprintf_INT32(byYuPai, 5);
		String strScore = sprintf_INT32(lScore, 5);
		String strRoundScore = sprintf_INT32(lRoundScore, 5);
		String strlastOutCard = sprintf_INT32(byLastOutCard, 2);
		
		String dgtmsg = String.format("table_begin|%s|%d|%d|%d|%s|%d|%s|%s|%s", strParam, byZhuang, byRound,
				byMaxRound, stryuPai, byCurrentUser, strScore, strRoundScore, strlastOutCard);
		JSONObject json = new JSONObject();
		json.put("command", "dgtmsg");
		json.put("dgtmsg", dgtmsg);
		return json.toString();
	}
};


class SUBCMD_S_TableSide extends IJsonExport {
	int bySeatID;
	int card[] = new int[38];

	String getJsonData() {

		String strCard = sprintf_BYTE(card, 38);
	
		String dgtmsg = String.format("table_side|%d|%s", bySeatID, strCard);
		JSONObject json = new JSONObject();
		json.put("command", "dgtmsg");
		json.put("dgtmsg", dgtmsg);
		
		return json.toString();
	}
};

class SUBCMD_S_TableEnd extends IJsonExport {
	int cbSceneStatus;

	String getJsonData() {

		String dgtmsg = String.format("table_end|%d", cbSceneStatus);
		JSONObject json = new JSONObject();
		json.put("command", "dgtmsg");
		json.put("dgtmsg", dgtmsg);

		return json.toString();
	}
};



class SUBCMD_S_REPORT extends IJsonExport {
	int cbReason;
	int whoDismiss;
	int vecMaxWinScore[] = new int[5];
	int vecWinScore[] = new int[5];
	int vecLoseScore[] = new int[5];
	int vecResultScore[] = new int[5];
    int vecWinCnt[] = new int[5];
    int m_bombArray[] = new int[5];
    int banktime[] = new int[5];
    int nongmin[] = new int[5];
    int goutuitime[] = new int[5];
    
	String getJsonData() {

		String strMaxWinScore = sprintf_INT32(vecMaxWinScore, 5);
		String strWinScore = sprintf_INT32(vecWinScore, 5);
		String strLoseScore = sprintf_INT32(vecLoseScore, 5);
		String strResultScore = sprintf_INT32(vecResultScore, 5);
		String strWinCnt = sprintf_INT32(vecWinCnt, 5);
		String strBombCnt = sprintf_INT32(m_bombArray, 5);
		String strBank = sprintf_INT32(banktime, 5);
		String strNongMin = sprintf_INT32(nongmin, 5);
		String strGouTui = sprintf_INT32(goutuitime, 5);
		String dgtmsg = String.format("report|%d|%d|%s|%s|%s|%s|%s|%s|%s|%s|%s", cbReason, whoDismiss, strMaxWinScore, strWinScore,
				strLoseScore, strResultScore,strWinCnt,strBombCnt,strBank,strNongMin,strGouTui);
		JSONObject json = new JSONObject();
		json.put("command", "dgtmsg");
		json.put("dgtmsg", dgtmsg);

		return json.toString();
	}

	String getData() {

		String strWinScore = sprintf_INT32(vecWinScore, 5);
		String strLoseScore = sprintf_INT32(vecLoseScore, 5);
		String strResultScore = sprintf_INT32(vecResultScore, 5);

		return String.format("report|%d|%d|%s|%s|%s", cbReason, whoDismiss, strWinScore, strLoseScore, strResultScore);
	}
};

class SUBCMD_S_AgreeDismissRoom extends IJsonExport {
	int lUid;
	String szNickName;//
	int dwTableID;// ����ID

	String getJsonData() {
		String dgtmsg = String.format("agree_dismissroom|%d|%s|%d", lUid, szNickName, dwTableID);

		JSONObject json = new JSONObject();
		json.put("command", "dgtmsg");
		json.put("dgtmsg", dgtmsg);

		return json.toString();
	}
};

class SUBCMD_S_RefuseDismissRoom extends IJsonExport {
	int lUid;
	String szNickName;//
	int dwTableID;// ����ID

	String getJsonData() {
		String dgtmsg = String.format("refuse_dismissroom|%d|%s|%d", lUid, szNickName, dwTableID);
		JSONObject json = new JSONObject();
		json.put("command", "dgtmsg");
		json.put("dgtmsg", dgtmsg);

		return json.toString();
	}
};

class SUBCMD_S_JieSuan extends IJsonExport {
	int nUserScore[] = new int[5];
	public String getJsonData(){

		String strResultScore = sprintf_INT32(nUserScore, 5);
		
		String dgtmsg = String.format("jiesuan|%s", strResultScore);
		JSONObject json = new JSONObject();
		json.put("command", "dgtmsg");
		json.put("dgtmsg", dgtmsg);

		return json.toString();
	}
};

class SUBCMD_S_round extends IJsonExport {
	int round = 1;
	public String getJsonData(){

		
		String dgtmsg = String.format("round|%d", round);
		JSONObject json = new JSONObject();
		json.put("command", "dgtmsg");
		json.put("dgtmsg", dgtmsg);

		return json.toString();
	}
};


//脙茠脗炉脙鈥毭偮棵冣�毭偮矫兤捗偮冣�毭偮棵冣�毭偮矫兤捗偮冣�毭偮棵冣�毭偮矫兤捗偮冣�毭偮棵冣�毭偮矫兤捗偮冣�毭偮棵冣�毭偮矫兤捗偮冣�毭偮棵冣�毭偮矫兤捗偮冣�毭偮棵冣�毭偮矫兤捗偮冣�毭偮棵冣�毭偮�
class SUBCMD_S_Text extends IJsonExport {
	int m_lUid;// 脙茠脗炉脙鈥毭偮棵冣�毭偮矫兤捗⑩偓啪脙鈥毭偮该兤捗偮冣�毭偮棵冣�毭偮矫兤捗偮冣�毭偮棵冣�毭偮矫兤捗偮冣�毭偮棵冣�毭偮矫兤捗偮冣�毭偮棵冣�毭偮絀D脙茠脗炉脙鈥毭偮棵冣�毭偮矫兤捗偮冣�毭偮棵冣�毭偮矫兤捗偮冣�毭偮棵冣�毭偮�
	int m_wUserChairID;// 脙茠脗炉脙鈥毭偮棵冣�毭偮矫兤捗偮冣�毭偮棵冣�毭偮矫兤捗偮冣�毭偮棵冣�毭偮矫兤捗偮冣�毭偮棵冣�毭偮矫兤捗偮冣�毭偮棵冣�毭偮矫兤捗吢矫冣�毭偮幻兤捗偮冣�毭偮棵冣�毭偮矫兤捗偮冣�毭偮棵冣�毭偮�
	String szContent;
	String InputWenZi;
	String getJsonData() {
		String dgtmsg = String.format("text|%d|%d|%s|%s", m_lUid, m_wUserChairID, szContent,InputWenZi);

		JSONObject json = new JSONObject();
		json.put("command", "dgtmsg");
		json.put("dgtmsg", dgtmsg);
		return json.toString();
	}
};



class SUBCMD_S_StandUp extends IJsonExport {

	int m_lUid;// ���ID
	int m_wUserChairID;// ��λID
	int m_dwTableID;// ����ID

	String getJsonData() {

		String dgtmsg = String.format("standup|%d|%d|%d", m_lUid, m_wUserChairID, m_dwTableID);
		JSONObject json = new JSONObject();
		json.put("command", "dgtmsg");
		json.put("dgtmsg", dgtmsg);

		return json.toString();
	}
};













